<h2>Permission</h2>
<!-- bof div#col-contain -->
<div id="col-container">

	<!-- bof div#col-right -->
	<div id="col-right" class="span-15">
		<div class="col-wrap">
			<?php echo$form->create('Search', array('url' => '/permissions/dataSearch'))?>
			<p class="search-box" style="margin: 0px;">
				<label class="hidden" for="post-search-input">Search Name:</label> 	
				<?php echo$form->input('Search.name', array('class' => 'search-input', 'id' => 'name-search-input', 'label' => '', 'div' => false))?>
				<?php echo$form->submit('Search Name', array('class' => 'button', 'div' => false))?>
			</p>
		
			<input name="mode" value="list" type="hidden">
			<div class="tablenav">
				<div class="alignleft actions">			
					<?php echo$form->input('Search.permission', array('id' => 'category', 'class' => 'postform', 'options' => $controllers, 'empty' => 'Tất cả ','label' => '', 'div' => false))?> 
					<?php echo$form->submit('Apply', array('id' => 'post-query-submit', 'class' => 'button-secondary', 'div' => false))?>
				</div>
					
				<div class="tablenav-pages">
					<span class="displaying-num"><?php echo $paginator->counter(array( 'format' => 'Display %start%-%end% of %count%')); ?></span>
					<?php
						echo $paginator->options(array('url' => $this->passedArgs));
						echo $paginator->prev('« ', array('class' => 'prev page-numbers'));
						echo ' '.$paginator->numbers(array('class' => 'page-numbers', 'separator' => ' ', 'modulus' => '5')).' ';
						echo $paginator->next(' »', array('class' => 'next page-numbers'));
					?>
				</div>
				<!-- 
				<div class="view-switch">
					<a href="#"><?php echo$html->image('wp-admin/blank.gif', array('id' => 'view-switch-list', 'class' => 'current', 'title' => 'List View', 'alt' => 'List View', 'height' => '20', 'width' => '20'))?> </a> 
					<a href="#"><?php echo$html->image('wp-admin/blank.gif', array('id' => 'view-switch-excerpt', 'class' => 'current', 'title' => 'Excerpt View', 'alt' => 'Excerpt View', 'height' => '20', 'width' => '20'))?></a>
				</div>
				 -->
				<div class="clear"></div>
			</div>
			
			<div class="clear"></div>
			<?php echo$form->end()?>
		
			<?php echo$form->create('Delete', array('url' => '/permissions/multiDelete'))?>
			<table class="widefat post fixed" cellspacing="0">
				<thead>
					<tr>
						<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox"></th>
						<th scope="col" id="category-name" class="manage-column column-title"><?php echo$paginator->sort('Tên permission', 'name')?></th>
						<th scope="col" id="user-last-visit" class="manage-column column-date" style="width: 16%"><?php echo$paginator->sort('Alias', 'alias')?></th>
					</tr>
				</thead>
			
				<tfoot>
					<tr>
						<th scope="col" class="manage-column column-cb check-column" style=""><input type="checkbox"></th>
						<th scope="col" class="manage-column column-title" style=""><?php echo$paginator->sort('Tên permission', 'name')?></th>
						<th scope="col" class="manage-column column-date" style=""><?php echo$paginator->sort('Alias', 'alias')?></th>
					</tr>
				</tfoot>
			
				<tbody>
					<?php 
					foreach ($permissions as $permission)
					{
					?>
					<tr id="post-<?php echo$permission['Permission']['id']?>" class="alternate author-other status-publish iedit" valign="top">
						<th scope="row" class="check-column">
							<?php echo$form->input("record.".$permission['Permission']['id'], array('label' => '','type' => 'checkbox'))?>
						</th>
						<td class="post-title column-title">
							<strong><a class="row-title" href="#" title="Edit &quot;<?php echo$permission['Permission']['name']?>"><?php echo$permission['Permission']['name']?></a></strong>
							<div class="row-actions">
								<span class="edit"><a href="<?php echo$html->url('/permissions/edit/'.$permission['Permission']['id'])?>" title="Edit">Edit</a> | </span>
								<span class="delete"><a class="submitdelete" title="Delete" href="<?php echo$html->url('/permissions/delete/'.$permission['Permission']['id'])?>" onclick="if ( confirm('You are about to delete \'<?php echo$permission['Permission']['name']?>\'\n \'Cancel\' to stop, \'OK\' to delete.') ) { return true;}return false;">Delete</a></span>
							</div>
						</td>
						
						<td class="date column-date">
							<?php echo$permission['Permission']['alias'];?>
						</td>
					</tr>
					<?php 
					}
					?>
					
				</tbody>
			</table>
			
			<!-- bof tablenav -->
			<div class="tablenav">
				<div class="tablenav-pages">
					<span class="displaying-num"><?php echo $paginator->counter(array( 'format' => 'Display %start%-%end% of %count%')); ?></span>
					<?php
						echo $paginator->prev('«', array('class' => 'prev page-numbers'));
						echo ' '.$paginator->numbers(array('class' => 'page-numbers', 'separator' => ' ', 'modulus' => '5')).' ';
						echo $paginator->next('»', array('class' => 'next page-numbers'));
					?>
				</div>
				<div class="alignleft actions">
					<!-- 
					<select name="action2">
						<option value="-1" selected="selected">Bulk Actions</option>
						<option value="edit">Edit</option>
						<option value="delete">Delete</option>
					</select>
					 -->
					<?php echo$form->submit('Delete', array('name' => 'doaction2', 'class' => 'button-secondary action', 'div' => false))?> 
					<br class="clear">
				</div>
				<br class="clear">
			</div>
			<!-- eof tablenav -->
			<?php echo$form->end()?>
		</div>
	</div>
	<!-- eof div#col-right -->
	
	<!-- bof div#col-left -->
	<div id="col-left" class="span-8 last">
		<div class="col-wrap">
			<div class="form-wrap">
				<h3>Thêm Permission</h3>
				<?php echo$form->create('Permission', array('action' => 'add', 'class' => 'add:the-list: vaidate'))?>
					<div class="form-field form-required">
						<label for="cat_name">Tên Permission</label>
						<?php
							echo $form->input('Permission.permission', array('id' => 'category', 'class' => 'postform', 'options' => $controllers, 'label' => false, 'div' => false));
							echo ' : '.$form->input('Permission.action', array('id' => 'category', 'class' => 'postform', 'options' => $actions, 'label' => false, 'div' => false));
						?>
						<p>Chọn chức năng tương ứng</p>
					</div>
					
					<div class="form-field">
						<label for="category_alias">Alias</label>
						<?php
							echo $form->input('Permission.alias', array('label' => false, 'size' => 40, 'aria-required' => true, 'value' => '', 'id' => 'cat_alias', 'div' => false, 'error' => false));
							echo $form->error('Permission.alias') == true ? "<p>{$form->error('Permission.alias')}</p>" : "<p>Alias dùng để đại diện cho quyền này trong khi lấy thông tin qua url</p>";
						?>
					</div>
					
					<p class="submit"><?php echo$form->submit('Thêm Permission', array('class' => 'button', 'div' => false));?></p>
				<?php echo$form->end();?>
			</div>
		</div>
	</div>
	<!-- eof div#col-left -->
	
</div>
<!-- eof div#col-contain -->
			
</form>
<div id="ajax-response"></div>
<br class="clear">
